<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.prime.com.tr/ui"
	template="/WEB-INF/templates/layoutCourtier.xhtml">


	<ui:define name="content">

		<p:panel header="#{msgs.titrePanelPrincipal}"
			style="width:1200px;height:800px;">

			<p:panel style="width:100%;height:100%;">

				<h:panelGrid columns="2" cellpadding="2" border="1">

					<p:graphicImage value="images/network2.png" />

					<h:outputText
						value="___________#{manage.serviceClient.clientUtilisateur(1).raisonSociale}___________" />

				</h:panelGrid>
			</p:panel>
			<h:form>
				<p:commandButton image="ui-icon ui-icon-star" immediate="true"
					style="width:120px" value="logout" action="#{manage.logout}"
					ajax="false" />
			
				<p:commandButton image="ui-icon ui-icon-star" immediate="true"
					style="width:120px" value="#{msgs.accueil}" action="versaccueil"
					ajax="false" />
			</h:form>


			<h:form>


				<p:tabView id="tabView">

					<p:tab id="tab1" title="#{msgs.listePolices}:">
						<h:panelGrid columns="1" cellpadding="10">

							<h:outputText id="tab1Text"
								value="#{manage.serviceClient.clientUtilisateur(1).raisonSociale}" />

							<p:dataTable var="police" widgetVar="police"
								rowStyleClass="#{police.actif?null:'sup'}"
								emptyMessage="Pas de police correspondant au critère de recherche"
								value="#{manage.serviceClient.clientUtilisateur(1).listePolices}"
								paginator="true" rows="3" rowKey="#{police.key}"
								selection="#{manage.policeChoisie}" selectionMode="single"
								paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} 
			{NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
								rowsPerPageTemplate="3,10,15">

								<p:column filterBy="#{police.numeroPolice}"
									filterMatchMode="contains">
									<f:facet name="header">
										<h:outputText value="#{msgs.numero}" />
									</f:facet>
									<h:outputText value="#{police.numeroPolice}" />
								</p:column>

								<p:column sortBy="#{police.client.raisonSociale}">
									<f:facet name="header">
										<h:outputText value="#{msgs.assure}" />
									</f:facet>
									<h:outputText value="#{police.client.raisonSociale}" />
								</p:column>

								<p:column sortBy="#{police.assureur.raisonSociale}">
									<f:facet name="header">
										<h:outputText value="#{msgs.assureur}" />
									</f:facet>
									<h:outputText value="#{police.assureur.raisonSociale}" />
								</p:column>

								<p:column sortBy="#{police.dateDebut}">
									<f:facet name="header">
										<h:outputText value="#{msgs.dateDebut}" />
									</f:facet>
									<h:outputText value="#{police.dateDebut}">
										<f:convertDateTime dateStyle="short" />
									</h:outputText>
								</p:column>

								<p:column sortBy="#{police.dateFin}">
									<f:facet name="header">
										<h:outputText value="#{msgs.dateFin}" />

									</f:facet>
									<h:outputText value="#{police.dateFin}">
										<f:convertDateTime dateStyle="short" />
									</h:outputText>
								</p:column>

								<p:column>
									<f:facet name="header">
										<h:outputText value="#{msgs.prime}" />
									</f:facet>
									<h:outputText value="#{police.prime}" />
								</p:column>

								<p:column>
									<f:facet name="header">
										<h:outputText value="#{msgs.total}" />
									</f:facet>
									<h:outputText value="#{manage.totalI(police)}" />
								</p:column>

								<p:column>
									<f:facet name="header">
										<h:outputText value="___#{msgs.graphique}___" />
									</f:facet>
									<p:barChart value="#{manage.categoryModel(police)}"
										style="height:100px;" title="Prime/Indemnités" stacked="false"
										barMargin="100" min="0"
										max="#{manage.hauteurGraphique(police.prime)}" />
								</p:column>

								<p:column>
									<f:facet name="header">
										<h:outputText value="#{msgs.statut}" />
									</f:facet>
									<h:outputText value="#{police.statut}" />
								</p:column>

								<f:facet name="footer">
									<p:commandButton value="#{msgs.apercuSinistres}"
										image="ui-icon ui-icon-search" update="display3"
										oncomplete="modif3.show()" />


									<p:dialog header="#{msgs.apercuSinistres}:" widgetVar="modif3"
										resizable="false" width="1200" showEffect="clip"
										hideEffect="fold">

										<h:panelGrid id="display3" columns="2" cellpadding="4">

											<p:dataTable var="sinistre"
												value="#{manage.policeChoisie.listeSinistres}"
												paginator="true"
												rowStyleClass="#{sinistre.actif?null:'sup'}"
												widgetVar="sinistre"
												emptyMessage="Pas de sinistre au critère de recherche"
												rows="10" rowKey="#{sinistre.key}"
												paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} 
			{NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
												rowsPerPageTemplate="5,10,15">


												<p:column sortBy="#{sinistre.police.numeroPolice}">
													<f:facet name="header">
														<h:outputText value="#{msgs.police}" />
													</f:facet>
													<h:outputText value="#{sinistre.police.numeroPolice}" />
												</p:column>

												<p:column sortBy="#{sinistre.police.client.raisonSociale}">
													<f:facet name="header">
														<h:outputText value="#{msgs.client}" />
													</f:facet>
													<h:outputText
														value="#{sinistre.police.client.raisonSociale}" />
												</p:column>

												<p:column sortBy="#{sinistre.police.assureur.raisonSociale}">
													<f:facet name="header">
														<h:outputText value="#{msgs.assureur}" />
													</f:facet>
													<h:outputText
														value="#{sinistre.police.assureur.raisonSociale}" />
												</p:column>

												<p:column filterBy="#{sinistre.numeroSinistre}"
													filterMatchMode="contains">
													<f:facet name="header">
														<h:outputText value="#{msgs.numero}" />
													</f:facet>
													<h:outputText value="#{sinistre.numeroSinistre}" />
												</p:column>

												<p:column filterBy="#{sinistre.prenom}"
													filterMatchMode="contains">
													<f:facet name="header">
														<h:outputText value="#{msgs.prenom}" />
													</f:facet>
													<h:outputText value="#{sinistre.prenom}" />
												</p:column>

												<p:column filterBy="#{sinistre.nom}"
													filterMatchMode="contains">
													<f:facet name="header">
														<h:outputText value="#{msgs.nom}" />
													</f:facet>
													<h:outputText value="#{sinistre.nom}" />
												</p:column>

												<p:column sortBy="#{sinistre.dateDebut}">
													<f:facet name="header">
														<h:outputText value="#{msgs.debutPeriode}" />
													</f:facet>
													<h:outputText value="#{sinistre.dateDebut}">
														<f:convertDateTime dateStyle="short" />
													</h:outputText>
												</p:column>

												<p:column sortBy="#{sinistre.dateFin}">
													<f:facet name="header">
														<h:outputText value="#{msgs.finPeriode}" />
													</f:facet>
													<h:outputText value="#{sinistre.dateFin}">
														<f:convertDateTime dateStyle="short" />
													</h:outputText>
												</p:column>

												<p:column>
													<f:facet name="header">
														<h:outputText value="#{msgs.indemnite}" />
													</f:facet>
													<h:outputText value="#{sinistre.indemnite}" />
												</p:column>

												<p:column>
													<f:facet name="header">
														<h:outputText value="#{msgs.statut}" />
													</f:facet>
													<h:outputText value="#{sinistre.statut}" />
												</p:column>




											</p:dataTable>


										</h:panelGrid>

									</p:dialog>

								</f:facet>


							</p:dataTable>


						</h:panelGrid>
					</p:tab>

					<p:tab id="tab3" title="Infos">
						<h:panelGrid columns="1" cellpadding="10">

							<h:outputText id="tab3Text" value="Contact: " />
							<h:outputText value="M. Leresponsable" />
							<h:outputText value="Leresponsable@courtier.ch" />
							<h:outputText value="Tel: 022 111 11 11" />
						</h:panelGrid>
					</p:tab>

				</p:tabView>


			</h:form>


		</p:panel>

	</ui:define>
</ui:composition>